<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt"%>
<%@ taglib uri="/WEB-INF/tld/core.tld" prefix="c" %>
<html>
<head>
<%@ include file="../common.jsp" %>
<script type="text/javascript" src="js/artDialog/artDialog.js?skin=idialog"></script>
<script type="text/javascript" src="js/artDialog/plugins/iframeTools.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script type="text/javascript" src="js/planeButton.js"></script>
<script type="text/javascript" src="<%=basePath %>js/datePicker/WdatePicker.js" defer="defer"></script>
<script type="text/javascript">
check = function(changebox,salePrice,salePriceOld) {
		if ($.trim(changebox) ==0) {
			alert('请选择退款类型！');
			return false;
		} else if ($.trim(salePrice) == null || $.trim(salePrice) == '') {
			alert('请输入退款金额！');
			return false;
		}else if ($.trim(salePrice)>salePriceOld) {
			alert('退款金额不能大于支付金额');
			return false;
		}
		else{
			return true;
		}
	};

	refund = function(id) {
		art.dialog({
					padding : 0,
					id : 'nt_' + id,
					title : '申请退款',
					content : '<lable>退款类型：</lable>'
					+'<select id="changebox">'
					+'<option value="0" ${(vo.mobileRecord.title==0||vo.mobileRecord.title==null)?"selected":""}>请选择</option>'
					+'<option value="部分退款" ${(vo.mobileRecord.title==1)?"selected":"" }>部分退款</option>'
					+'<option value="全额退款" ${(vo.mobileRecord.title==2)?"selected":"" }>全额退款</option>'
					+'</select>'
					+'<br/><lable>退款金额：</lable><input id=\"salePrice\"><lable>元</lable>',
					width : '20em',
					lock : true,
					ok : function() {		
					var changebox = $("#changebox").val();
					var salePrice = $("#salePrice").val();
					var orderId=$('#orderId').html();
					var salePriceOld=${vo.mobileRecord.salePrice};
					if (check(changebox,salePrice,salePriceOld)==true){
						$.ajax({
							url : 'mobileRecordDetail_doAddRefund.shtml?',
							type : "post",
							data : {
								'id' : id,
								'changebox' : changebox,
								'salePrice' : salePrice,
								'orderId' : orderId
							},
							cache : false,						
							loading : this.content('申请正在处理中，请等待……'),
								success : function(data) {
									var result = '';
									if (data == 'success') {
										result = '申请提交成功';
									} else {
										result = data;
									}
									closeAllDialog();
									art.dialog({
											lock: true,
											title : '系统提示',
											content : ''
													+ result
													+ '，2秒后关闭……',
											time : 2,
											close : function() {
												location.href="mobile/mobileRecordDetail_list.shtml?mid=${vo.mobileRecord.id}";
											}
										});
									}
							});	
						}
					    return false;
					},
					cancelVal : '取消',
					cancel : true
				});
	};
</script>
	
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td valign="top" background="images/content-bg.gif"><div class="titlebt">详细信息</div></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><br/>
<table class="mytable" cellpadding="0" cellspacing="0">
	<th colspan="3">话费信息</th>
	<tr>
		<td class="left"><label >订单号：<span id="orderId">${vo.mobileRecord.orderId}</span></label></td>
		<td><label>用户编号：${vo.mobileRecord.memberNo}</label></td>
	</tr>
	<tr>
	<td class="left"><label id="tranid">平台订单号：${vo.mobileRecord.tranid}</label></td>
	<td><label>状态：
	<s:if test="vo.mobileRecord.laststate==0">处理中 </s:if>
	<s:elseif test="vo.mobileRecord.laststate==2">充值成功</s:elseif>
	<s:elseif test="vo.mobileRecord.laststate==3">部分成功</s:elseif>
	<s:elseif test="vo.mobileRecord.laststate==4">充值失败</s:elseif>
	<s:elseif test="vo.mobileRecord.laststate==5">创建订单</s:elseif>
	</label></td>
	</tr>
	<tr>
		<td class="left"><label>充值号码：${vo.mobileRecord.phonenum}</label></td>
		<td><label>返回结果：${vo.mobileRecord.resultNo}</label></td>
	</tr>
	<tr>
		<td class="left"><label>创建时间：</label><s:date name="vo.mobileRecord.dateTime" format="yyyy年MM月dd日 HH:mm:ss"/></td>
		<td ><label>通知时间：<s:date name="vo.mobileRecord.noticeTime" format="yyyy年MM月dd日 HH:mm:ss"/></label></td>
	</tr>
	<tr>
		<td class="left"><label>支付时间：<s:date name="vo.mobileRecord.payTime" format="yyyy年MM月dd日 HH:mm:ss"/></label></td>
		<td ><label>充值面额：</label><fmt:formatNumber value="${vo.mobileRecord.proPrice}" pattern="￥0.00"></fmt:formatNumber>
		</td>
	</tr>
	<tr>
		<td class="left"><label>支付金额：</label><fmt:formatNumber value="${vo.mobileRecord.salePrice}" pattern="￥0.00"></fmt:formatNumber></td>
		<td ><label>实际完成面额：</label><fmt:formatNumber value="${vo.mobileRecord.realPrice}" pattern="￥0.00"></fmt:formatNumber></td>
	</tr>
	<tr>
		<td class="left"><label>产品ID编号：${vo.mobileRecord.prodId}</label></td>
		<td><label>产品描述：${vo.mobileRecord.prodInfo}</label></td>
	</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="5" >
<tr><td width="150">&nbsp;</td>
<td align="right"><input type="button" class="Submit" value="申请退款" onclick="refund('${vo.mobileRecord.id}')"/>
	</td>
<td width="50">&nbsp;</td>
</tr>
</table>
 
<br/>
    </td>
   
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  

  <tr>
    <td valign="bottom" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
    <td background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17"></td>
    <td valign="bottom" background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
</html>